//
//  JMAnswerCell.m
//  VoluntaryStar
//
//  Created by xiaorui on 15/9/10.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "JMAnswerCell.h"
#import "JMHeader.h"
#import "UIViewExt.h"

@interface JMAnswerCell()

@end


@implementation JMAnswerCell

- (UIImageView *)iconImageView
{
    if (!_iconImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        imageView.layer.masksToBounds = YES;
        imageView.layer.borderWidth = 0.1;
        imageView.backgroundColor = [UIColor clearColor];
        _iconImageView = imageView;
        [self addSubview:_iconImageView];
    }
    return _iconImageView;
}

- (UILabel *)nameLabel
{
    if (!_nameLabel) {
        UILabel* label = [[UILabel alloc]init];
        label.backgroundColor = [UIColor clearColor];
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:14.0f];
        label.backgroundColor = [UIColor clearColor];
        _nameLabel = label;
        [self addSubview:_nameLabel];
    }
    return _nameLabel;
}

- (UILabel *)timeLabel
{
    if (!_timeLabel) {
        UILabel* label = [[UILabel alloc]init];
        label.backgroundColor = [UIColor clearColor];
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:12.0f];
        label.textColor = UIColorFromRGB(0xbebebe);
        _timeLabel = label;
        [self addSubview:_timeLabel];
    }
    return _timeLabel;
}

- (UITextView *)textView
{
    if (!_textView) {
        _textView = [[UITextView alloc]init];
        _textView.backgroundColor = [UIColor clearColor];
        [self addSubview:_textView];
    }
    return _textView;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.iconImageView.frame = CGRectMake(UI_SCREEN_WITH *0.046875, 5, UI_SCREEN_WITH *0.046875, UI_SCREEN_WITH *0.046875);
    self.nameLabel.frame = CGRectMake(self.iconImageView.frameRight + 5, 5, UI_SCREEN_WITH *0.4, UI_SCREEN_WITH *0.046875);
    self.timeLabel.frame = CGRectMake(self.nameLabel.frameLeft, self.nameLabel.frameBottom + 6, self.nameLabel.frameWidth, self.nameLabel.frameHeight);
    self.textView.frame = CGRectMake(20, self.timeLabel.frameBottom + 8, UI_SCREEN_WITH - 40, self.frameHeight - self.timeLabel.frameBottom - 8 - 3);
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
